/**
* 
* ====================================================================
*
* @author apov <apov@ymail.com>
*/ 
#pragma once

#include <BaseDefine.h>
#include <KeyValueManager.h>
#include <string>

class StateSet;
class StateLoader;
class StateService{
	typedef KeyValueManager< std::string, StateSet* > States;

public:
	//err test
	//////////////////////////////////////////////////////////////////////////
	int initialize_dummy( char* file_name );
	//////////////////////////////////////////////////////////////////////////
	int initialize( char* file_name );
	StateSet* register_stateset( char* name );
	StateSet* get_stateset( char* name );

	StateService();
	virtual ~StateService();

	static StateService* Instance();
	static void Shutdown();

protected:

private:
	StateLoader* loader_;
	States states_;
};

static StateService* StateService_ = 0;

inline StateService* StateService::Instance(){
	if(! StateService_ )
		StateService_ = new StateService();

	return StateService_;
}

inline void StateService::Shutdown(){
	SAFE_DELETE( StateService_ );
}
